package com.jzo2o.orders.manager.strategy;

import java.math.BigDecimal;

/**
 * @author Mr.M
 * @version 1.0
 * @description 策略环境类
 * @date 2023/12/29 12:01
 */
public class ShoppingCart {

    //策略接口
    private PaymentStrategy paymentStrategy;

    public void setPaymentStrategy(PaymentStrategy paymentStrategy) {
        this.paymentStrategy = paymentStrategy;
    }

    //结账
    public void checkout(BigDecimal amount){
        //调用策略接口的方法
        paymentStrategy.pay(amount);

    }

}
